plugins {
    id 'java'
    id 'maven-publish'
}

repositories {
    mavenLocal()
    maven {
        url = uri('https://repo.maven.apache.org/maven2/')
    }
}

ext {
    swagger_annotations_version = "2.2.8"
    jackson_version = "2.14.2"
    jersey_version = "3.1.1"
    junit_version = "4.13.2"
}

dependencies {
    implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version"
    implementation "org.glassfish.jersey.core:jersey-client:$jersey_version"
    implementation "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version"
    implementation "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version"
    implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
    implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
    implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
    {{#withXml}}
    implementation "org.glassfish.jersey.media:jersey-media-jaxb:$jersey_version"
    {{/withXml}}
    implementation "org.glassfish.jersey.inject:jersey-hk2:$jersey_version"
    testImplementation "junit:junit:$junit_version"
    {{#wiremock}}
    testImplementation "com.github.tomakehurst:wiremock:2.27.2"
    {{/wiremock}}
}

group = '{{groupId}}'
version = '{{artifactVersion}}'
description = '{{artifactDescription}}'

java.sourceCompatibility = 1.8
java.targetCompatibility = 1.8

tasks.register('testsJar', Jar) {
    archiveClassifier = 'tests'
    from(sourceSets.test.output)
}

java {
    withSourcesJar()
    withJavadocJar()
}

publishing {
    publications {
        maven(MavenPublication) {
            from(components.java)
            artifact(testsJar)
        }
    }
}

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}
